Add @react-grab/paper package for Paper clipboard paste#211
Add @react-grab/paper package for Paper clipboard paste#211
Conversation
Converts DOM elements to Paper's native clipboard paste format (paper-paste-start embed). Supports colors (lab/oklab/oklch/srgb → OKLCH), native SVG nodes with fill+stroke, React component names via bippy, text with font/color/size, backgrounds, borders, shadows, gradients, multi-element selection, and getBoundingClientRect sizing. Made-with: Cursor
|
This run croaked 😵 The workflow encountered an error before any progress could be reported. Please check the link below for details. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Made-with: Cursor
@react-grab/cli
grab
@react-grab/ami
@react-grab/amp
@react-grab/claude-code
@react-grab/codex
@react-grab/copilot
@react-grab/cursor
@react-grab/droid
@react-grab/gemini
@react-grab/opencode
react-grab
@react-grab/relay
@react-grab/utils
commit: |
Fixes Vercel build failure where tsup tried to resolve @react-grab/paper/dist before the workspace dep was built. Made-with: Cursor
There was a problem hiding this comment.
3 issues found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/paper/src/constants.ts">
<violation number="1" location="packages/paper/src/constants.ts:57">
P2: Regex matches unintended class names due to missing word boundaries</violation>
</file>
<file name="packages/paper/package.json">
<violation number="1" location="packages/paper/package.json:11">
P2: Dual package type exports lack explicit `.d.cts` for CommonJS, which causes TypeScript errors under `Node16` module resolution.</violation>
<violation number="2" location="packages/paper/package.json:18">
P2: The `rm -rf dist` command is not cross-platform and is redundant since `tsup` is already configured to clean the output directory.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| export const UNIQUE_ID_LENGTH = 26; | ||
|
|
||
| export const UTILITY_CLASS_PATTERN = | ||
| /^(flex|grid|p[xytrbl]?-|m[xytrbl]?-|w-|h-|bg-|text-|border-|rounded|shadow|opacity-|gap-|space-|font-|leading-|tracking-|overflow-|z-|relative|absolute|fixed|sticky|hidden|block|inline|sr-only|col-|row-|items-|justify-|self-|order-|grow|shrink|basis-)/; |
There was a problem hiding this comment.
P2: Regex matches unintended class names due to missing word boundaries
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/paper/src/constants.ts, line 57:
<comment>Regex matches unintended class names due to missing word boundaries</comment>
<file context>
@@ -0,0 +1,57 @@
+export const UNIQUE_ID_LENGTH = 26;
+
+export const UTILITY_CLASS_PATTERN =
+ /^(flex|grid|p[xytrbl]?-|m[xytrbl]?-|w-|h-|bg-|text-|border-|rounded|shadow|opacity-|gap-|space-|font-|leading-|tracking-|overflow-|z-|relative|absolute|fixed|sticky|hidden|block|inline|sr-only|col-|row-|items-|justify-|self-|order-|grow|shrink|basis-)/;
</file context>
| ], | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", |
There was a problem hiding this comment.
P2: Dual package type exports lack explicit .d.cts for CommonJS, which causes TypeScript errors under Node16 module resolution.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/paper/package.json, line 11:
<comment>Dual package type exports lack explicit `.d.cts` for CommonJS, which causes TypeScript errors under `Node16` module resolution.</comment>
<file context>
@@ -0,0 +1,23 @@
+ ],
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js",
+ "require": "./dist/index.cjs"
</file context>
| ): Promise<string> => { | ||
| const { domToPaper } = await import("./dom-to-paper"); | ||
| const html = domToPaper(nodeOrNodes, options); | ||
| await navigator.clipboard.writeText(html); |
There was a problem hiding this comment.
copyDomToPaper writes HTML as plain text MIME
High Severity
copyDomToPaper calls navigator.clipboard.writeText(html) which writes the Paper embed HTML to the clipboard as text/plain. Paper reads paste data from the text/html MIME type (as seen in copy-content.ts line 177 using clipboardData.setData("text/html", ...)). This means the standalone copyDomToPaper function will never produce a paste that Paper can recognize. It needs to use navigator.clipboard.write() with a ClipboardItem containing a text/html blob.
| const color = cssColorToPaper(stopMatch[1]); | ||
| if (!color) continue; | ||
| stops.push({ position: stopMatch[2] ? parseFloat(stopMatch[2]) / 100 : -1, color, midpoint: 0.5 }); | ||
| } |
There was a problem hiding this comment.
Gradient parser ignores non-rgb color stop formats
Medium Severity
The stopRegex in parseLinearGradient only matches rgb()/rgba() color stops, but the code's own comment (lines 115–116) acknowledges modern Chromium returns computed colors in lab()/oklch()/oklab() formats. When a computed backgroundImage contains gradient stops in these modern formats, the regex won't match any stops, stops.length < 2 triggers, and the entire gradient is silently dropped.
|
@cursoragent vercel build failing |
|
I've fixed the Vercel build failure by addressing the following issues identified by the automated reviewers: Changes Made
Why This Fixes the BuildThe The changes have been committed and pushed to the |
- Remove redundant 'rm -rf dist' and 'NODE_ENV=production' from @react-grab/paper build script (tsup already handles cleaning and production mode) - Delete accidentally committed debugging files: inspect-layout.js and inspect-page.html - Update built script.js after changes Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| } | ||
|
|
||
| const stops: PaperGradientStop[] = []; | ||
| const stopRegex = /(rgba?\([^)]+\))\s*([\d.]+%)?/g; |
There was a problem hiding this comment.
Gradient stop regex ignores non-rgb color formats
Medium Severity
The stopRegex in parseLinearGradient only matches rgb()/rgba() color stops, but the code's own comment (lines 115–116) acknowledges that modern Chromium returns computed colors in oklch()/oklab()/lab() formats. If a gradient's computed value uses these non-rgb color formats, no stops are captured, stops.length < 2 triggers, and the gradient is silently dropped. The same issue exists in parseBoxShadows where its regex also only matches rgba?(). Both parsers are inconsistent with parseRgbColor, which handles all six color formats.





Converts DOM elements to Paper's native clipboard paste format (paper-paste-start embed). Supports colors (lab/oklab/oklch/srgb → OKLCH), native SVG nodes with fill+stroke, React component names via bippy, text with font/color/size, backgrounds, borders, shadows, gradients, multi-element selection, and getBoundingClientRect sizing.
Made-with: Cursor
Note
Medium Risk
Introduces a large new DOM/CSS-to-clipboard conversion path and changes clipboard HTML payload generation, which could cause unexpected paste behavior or runtime issues across browsers/sites.
Overview
Adds a new workspace package
@react-grab/paperthat converts DOM nodes into Paper’s native clipboard embed (paper-paste-start), including style/geometry extraction and SVG handling, plus small test artifacts (test-paste.html, sample clipboard HTML).Integrates Paper output into
react-grab’s copy pipeline by generatingpaperHtml(with React component-based layer naming viabippy) and embedding it into thetext/htmlclipboard payload while keeping the existing plain-text/HTML fallback behavior. Updates monorepo build/dev filters and bundling (tsup noExternal) to include the new package and adds it as a dependency ofreact-grab.Written by Cursor Bugbot for commit 4cd1f98. This will update automatically on new commits. Configure here.
Summary by cubic
Adds a new @react-grab/paper package and hooks it into the copy flow to generate Paper clipboard embeds from selected DOM. Also fixes Vercel builds by simplifying the Paper build and removing stray debug files.
New Features
Dependencies
Written for commit 4cd1f98. Summary will update on new commits.